package com.pe.pgn.clubpgn.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.pe.pgn.clubpgn.dao.VentaDao;
import com.pe.pgn.clubpgn.domain.ClpmVenta;
import com.pe.pgn.clubpgn.service.VentaGeneracionService;
import com.pe.pgn.clubpgn.service.support.AbstractExposedDisplayTagService;

@SuppressWarnings("unchecked")
@Service("ventaGeneracionService")
public class VentaGeneracionServiceImpl extends AbstractExposedDisplayTagService<ClpmVenta> implements VentaGeneracionService{

	@Autowired
	private VentaDao ventaDao;
	
	public VentaGeneracionServiceImpl(){
		setTableId("venta");
		setViewFragment("/wizard/ventasgeneracion.html");
	}
	
	public List getObjects(int firstResult, int maxResults, String orderBy, boolean ascending, String[] filters) {
		List<ClpmVenta> ventas = ventaDao.buscarVentas(firstResult, maxResults, orderBy, ascending, filters);
		return ventas;
	}

	public String getObjectsName() {
		return "ventas";
	}

	public int getNumberOfObjects(String[] filters) {
		return ventaDao.obtenerNumeroVentas(filters);
	}

	public String getNumberOfObjectsName() {
		return "numberOfVentas";
	}
}
